#include "account.h"
#include "ui_account.h"
#include<QDesktopWidget>
//This class show options for account like create,edit,delete

account::account(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::account)
{
    ui->setupUi(this);
    QRect innersize=QApplication::desktop()->availableGeometry(this);
    //ui->listWidget->setGeometry(0,50,(innersize.width()),(innersize.height()));
    ui->scrollArea->setGeometry(0,0,(innersize.width()),(innersize.height()));

    ui->listWidget->setEditFocus(true);
    int fontSize=10;//(innersize.width()/30.0);
    //QIcon(":/myresources/images/img1.png")
    item1=new QListWidgetItem("New Account",ui->listWidget,QListWidgetItem::UserType);
    item1->setFont(QFont( "lucida", fontSize, QFont::Normal, FALSE ));

    item2=new QListWidgetItem("Edit Account",ui->listWidget,QListWidgetItem::UserType);
    item2->setFont(QFont( "lucida", fontSize, QFont::Normal, FALSE ));

    item3=new QListWidgetItem("Delete Account",ui->listWidget,QListWidgetItem::UserType);
    item3->setFont(QFont( "lucida", fontSize, QFont::Normal, FALSE ));

    QAction* backAction = new QAction( tr("Back"), this );
     backAction->setSoftKeyRole( QAction::NegativeSoftKey );
     connect(backAction, SIGNAL(triggered()), this, SLOT(back()));
     addAction( backAction );
}

account::~account()
{
    delete ui;
}
void account::back()
{

  (new MainWindow)->show();
}


void account::on_listWidget_itemActivated(QListWidgetItem* item)
{
    if(item==item1)
    {
        New_account *new_acc=new New_account(0);
        new_acc->setWindowTitle("New Account");
        new_acc->show();
    }
    else if(item==item2)
    {
        Edit_account *edit_acc=new Edit_account(0);
        edit_acc->setWindowTitle("Edit Account");
        edit_acc->show();
    }
    else if(item==item3)
    {
        Edit_account *edit_acc=new Edit_account(1);
        edit_acc->setWindowTitle("Delete Account");
        edit_acc->show();
    }


}
